<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.lable.select"/><spring:message code="message.listForm.pinGui"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
							
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class="input">
                	<div class="textalign1"><spring:message code="message.listForm.tongYongMing"/><spring:message code="message.yanZheng.maoHao"/></div>
                        <div class="boxinput">
                        <input type="text" class="textinput" id="qualityspecName" placeholder="<spring:message code="message.listForm.tongYongMing"/>" maxlength="200" />
                    	</div>
                    
                    <div class="textalign"><spring:message code="message.listForm.pinGuiBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
                        <div class="boxinput">
                        <input type="text" class="textinput" id="qualityspecCode" placeholder="<spring:message code="message.listForm.pinGuiBianMa"/>" maxlength="50" />
                    	</div>
                    <div class="textalign" >
                    <button type="button" class="btn btn-success btn-sm" onclick="search();" id="selectDrug"><spring:message code="message.button.seachSpacing"/></button>
                    </div>
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        
        <div class=" box box-warning bottongroup">
            <button type="button" id="confirm"  onclick="confirm();" class="btn btn-default btn-sm"><spring:message code="message.button.okSpacing"/></button>
        </div>
  
    </section>
    
   <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    
    <script type="text/javascript">
    	
    
    //绑定回车
    $('#qualityspecCode,#qualityspecName').bind('keydown', function(event) {
        if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
            $('#selectDrug').click();
        }
    }); 
    	
    	function search(page) {
    		var qualityspecCode = $.trim($("#qualityspecCode").val());
    		var qualityspecName = $.trim($("#qualityspecName").val());
    		$("#gridlist").jqGrid('setGridParam',{  
    	        datatype:'json',
    	        postData:{"qualityspecCode":qualityspecCode, "qualityspecName":qualityspecName},
    	        page : (page || 1)
    	    }).trigger("reloadGrid"); //重新载入  
    	}
    
        $(function () {
        	
        	$("#qualityspecName").focus();//加载页面光标在第一个查询框内
        	
            $("#gridlist").jqGrid({
                url: "${ctx}/stdProdDrugInfo/getSelectQualityspec.html",
                mtype: "post",
                datatype: "json",
                autowidth: true,
                shrinkToFit:false,
                height: 270,
                colNames: [
                    '<spring:message code="message.listForm.pinGui"/>id',
					'<spring:message code="message.listForm.pinGuiBianMa"/>', 
					'<spring:message code="message.listForm.tongYongMing"/>', 
					'<spring:message code="message.listForm.tongYongMingEnglish"/>',
					'<spring:message code="message.listForm.jiXing"/>', 
					'<spring:message code="message.listForm.guiGe"/>',
					'dicCode',
					'药品来源'
                ],
                colModel: [
                    { name: 'qualityspecId',width: 100,hidden:true, align:"center", sortable: false},
                    { name: 'qualityspecCode', width: 120, align:"center", sortable: false },
                    { name: 'qualityspecName', width: 200, align:"left", sortable: false},
                    { name: 'qualityspecNameEng', width: 180, align:"left", sortable: false},
                    { name: 'formName', width: 100, align:"center", sortable: false},
                    { name: 'specName', width: 120, align:"left", sortable: false},
                    { name: 'remark', width: 120, hidden:true, align:"left", sortable: false},
                    { name: 'dicName', width: 120,hidden:true, align:"left", sortable: false}
                ],
                rowNum: 20,
                rowList: [10, 20, 50,100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                caption: "<spring:message code="message.list.drugqualityspecStdlist"/>",
              //序号宽度自动变化
                gridComplete:function(){
                    //序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                    //数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                },
                jsonReader: {
                    id: "qualityspecId"
                }
            });
            
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            

            $(window).trigger("resize");
            
        });
        
      //确认
        function confirm() {
            var rowId = $("#gridlist").jqGrid("getGridParam", "selrow") || [];
             if(rowId.length <=0){
                $.HN.message.alert("<spring:message code="message.lable.pleaseSelectOperational"/><spring:message code="message.listForm.pinGui"/><spring:message code="message.yanZheng.ganTanHao"/>", "<spring:message code="message.HN.alert.type"/>", "warn");
                return;
             }
             var rowdata = $("#gridlist").jqGrid('getRowData', rowId);
             var dialog = top.dialog.get(window);
             var params = {
            	"qualityspecId" : rowdata.qualityspecId,
             	"qualityspecName" : rowdata.qualityspecName,
             	"qualityspecNameEng" : rowdata.qualityspecNameEng,
             	"formName" : rowdata.formName,
             	"specName" : rowdata.specName,
             	"remark":rowdata.remark,
             	"dicName":rowdata.dicName
             };
             dialog.close(params);   // 关闭（隐藏）对话框
             dialog.remove();        // 主动销毁对话框
        }
    </script>
</body>
</html>












